from RequestTest.request.approval_request import ApprovalRequest


def test_get_templatelista():
    cookie = "mp_version=23502;sid=2EF02C7F5F91095D575A536E59775133F6438C789075F644D2D6577C906C10D675AED724DB68583AB9D17A89698CF7C914BC6B22F871BFF97B8B5EF7CF02E7A2;vid=1688854758386050;skey=pKFCKMNVTtGBeCCNgUUoPQAA;gid=2251802431922099"
    aq = ApprovalRequest(cookie)
    r = aq.get_templatelist()
    data = r.json()["data"]["items"]
    # print(data[0]['template_name'])
    tname = []
    for i in range(24):
        tname.append(data[i]['template_name'])
    print(tname)


def test_get_templatesearcha():
    cookie = "mp_version=23502;sid=2EF02C7F5F91095D575A536E59775133F6438C789075F644D2D6577C906C10D675AED724DB68583AB9D17A89698CF7C914BC6B22F871BFF97B8B5EF7CF02E7A2;vid=1688854758386050;skey=pKFCKMNVTtGBeCCNgUUoPQAA;gid=2251802431922099"
    aq = ApprovalRequest(cookie)
    r = aq.get_templatesearch("请")
    data = r.json()["data"]["list"]
    tname = []
    for i in range(len(data)):
        tname.append(data[i]['template_name'])
    print(tname)
    print(r.json())


